// pages/user_proxy/money_id.js
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		user: null
	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad: function(options) {
		wx.$getServerUserInfo(true).then((res) => {
			this.setData({
				user: res
			})
		});
	},

	/**
	 * 绑定支付宝账号
	 */
	bindAlipayAccount: function(e) {
		const values = e.detail.value;
		values.alipay_account = values.alipay_account.trim();

		if (!values.alipay_account.length) {
			return wx.hintError("请填写支付宝收款账号");
		}

		wx.$bindAlipayAccount(values, {
			loading: true
		}).then(() => {
			wx.showModal({
				content: '已绑定支付宝收款账号【' + values.alipay_account + '】',
				showCancel: false,
				success: () => {
					wx.navigateBack();
				}
			});
		});
	}
})
